Why am I getting an error with string concatenation in my JavaScript code